package com.studentSystem.anno;

import com.studentSystem.validation.GenderValidation;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Documented//元注解
@Target({FIELD})//元注解
@Retention(RUNTIME)//元注解
@Constraint(validatedBy = {GenderValidation.class})//指定提供校验规则的类
public @interface Gender {
    //提供校验失败后的提示信息
    String message() default "gender参数的值只能是男或者女";

    //指定分组
    Class<?>[] groups() default {};

    //负载来获取到Role注解的附加信息
    Class<? extends Payload>[] payload() default {};

}
